<template>
    <div>
        <!-- <div v-if="!isshow">
      <h1>请登录 <router-link to="/login" tag="button">请登录</router-link> </h1>
    </div> -->

        <div>
            <h1>你好{{ mine.username }}</h1>
            <div>
                <button @click="logout">退出登录</button>
            </div>
        </div>
        <foot></foot>
    </div>
</template>

<script>
import { getAllPro } from "@/api/request";
import foot from "@/components/common/foot.vue";
export default {
    data() {
        return {
            mine: {},
            // isshow:false
        };
    },
    created() {
        this.getShop();
    },
    // 改为同步
    methods: {
        async getShop() {   
            // let token = localStorage.getItem("token");
            // if (token) {
                this.isshow = true;
                let res = await getAllPro("/mine");
                let { data } = res;
                this.mine = data[0];
            // }
        },
        logout() {
            localStorage.removeItem("token");
            this.$router.push("/");
        },
    },
    components: {
        foot,
    },
};
</script>

<style></style>
